# -*- coding:utf-8 -*-
import web, models
from baseHandler import BaseHandler
from utils.decorator import render

class Users(BaseHandler):
    @render(None, 'json')
    def POST(self):
        self.admin_requried()
        username = web.input().get('username')
        password = web.input().get('password')
        nickname = web.input().get('nickname')
        companyId = web.input().get('company_id')
        companyId = None if '-1' == companyId else companyId
        _type = web.input().get('type')
        models.User.addUser(username, password, nickname, companyId, _type)

